﻿using System.Web.Mvc;
using System.Web.Routing;

namespace CNav.App_Start
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            //DECLARE REGEX PATTERNS
            //const string alphanumeric = @"^[a-zA-Z]+[a-zA-Z0-9_]*$";
            const string numeric = @"^\d+$";

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
             name: "FormDesignDefault",
             url: "FormDesign/{formId}",
             defaults: new { controller = "FormDesign", action = "Index" },
             constraints: new { formId = numeric }); // id must be all digits

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional });

            routes.MapRoute(
              name: "Home",
              url: "",
              defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional });
        }
    }
}